/*
 * Copyright © 2024-2025 Wenze Wei
 *
 * This file is part of StadionOS.
 *
 * This Source Code Form is subject to the terms of the GNU General Public License, v. 2.0.
 * You can obtain a copy of the GPL at
 * https://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
 *
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
 * the specific language governing rights and limitations under the License.
 */

#include "../include/process.h"

/**
 * @brief Replaces the current process image with a new one.
 *
 * This function replaces the current process with a new process image specified by the filename.
 * The new process image is executed with the provided arguments and environment.
 *
 * @param filename The path to the executable file.
 * @param argv An array of pointers to the argument strings.
 * @return int 0 on success, or -1 on error.
 */
int Sexec(const char *filename, char *const argv[]) {
    return syscall(SYS_execve, filename, argv, NULL);
}
